package cn.zzzhy.core.descriptor;

import com.google.common.base.CaseFormat;
import com.google.common.collect.Lists;

import java.util.List;

/**
 * author:zzzhy
 * since :15/11/9.
 */
public class Table {

    public String tableName;
    private final String basePackageName;
    private final List<Column> columns = Lists.newArrayList();

    public Table(String name, String basePackageName) {
        this.tableName = name;
        this.basePackageName = basePackageName;
    }

    public List<Column> getColumns() {
        return columns;
    }

    public void addColumn(Column column){
        columns.add(column);
    }

    public String getTableEntityName(){
        return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL,tableName);
    }

    public String getEntityFullClassName() {
        return basePackageName + getTableEntityName();
    }

}
